using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThermalImagery.Model;
using ThermalImagery.Service;
using Leeder.Business;

namespace ThermalImagery.Business
{
    /// <summary>
    /// 
    /// </summary>
   public class ThermalCheckBLL : BaseBLL<ThermalCheckModel, ThermalCheckService>
   {
        public ThermalCheckBLL()
        {
            Service = new ThermalCheckService();
        }
        public List<ThermalCheckModel> GetModelAll()
        {
            return Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null)).ActivedObj;
        }
        public ThermalCheckModel GetModel()
        {
            return Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null)).ActivedObj.FirstOrDefault();
        }
        public List<ThermalCheckModel> GetModelListByCondition(DateTime startDate, DateTime endDate, string checkResult)
        {
            if (string.IsNullOrEmpty(checkResult))
                return Service.Query(p => p.CheckTime >= startDate && p.CheckTime <= endDate).ActivedObj;
            else
                return Service.Query(p => p.CheckTime >= startDate && p.CheckTime <= endDate && p.CheckResult == checkResult).ActivedObj;
        }
    }
}
